<?php
namespace app\crm\controller;
use think\Loader;

class Salereport extends CrmController
{
    /**
     * 加载performanceReport模板
     */
    public function goodsSaleReport()
    {
        //分配增删改的权限
        $menuname = "Goods Sale Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname];	
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('goodsSaleReport');
    }


    public function goodsSaleReportData()
    {
        $arrData = Loader::model('Salereport')->goodsSaleReportData();
        echo json_encode($arrData);
    }


    /**
     * 加载performanceReport模板
     */
    public function programSaleReport()
    {
        //分配增删改的权限
        $menuname = "Program Sale Report";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname]; 
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);

        // 模板输出
        return $this->fetch('programSaleReport');
    }


    public function programSaleReportData()
    {
        $arrData = Loader::model('Salereport')->programSaleReportData();
        echo json_encode($arrData);
    }


}

?>